import request from '@/utils/request'

const newsApi = {
  list: '/news/list',
  creat: '/news/add',
  edit: '/news/change',
  Delete: '/news/delete',
}

/**
 * newsList func
 * parameter: {
 *     username: '',
 *     password: '',
 *     captcha: '12345'
 * }
 * @param parameter
 * @returns {*}
 */
// 获取news列表
export function newsList (parameter) {
  return request({
    url: newsApi.list,
    method: 'get',
		headers: {
		  'Content-Type': 'application/json;charset=UTF-8'
		},
    params: parameter,
  })
}
// 创建news
export function newsCreat (parameter) {
  return request({
    url: newsApi.creat,
    method: 'post',
		headers: {
		  'Content-Type': 'application/json;charset=UTF-8'
		},
    params: parameter,
  })
}
// 编辑news
export function newsEdit (parameter) {
  return request({
    url: newsApi.edit,
    method: 'post',
		headers: {
		  'Content-Type': 'application/json;charset=UTF-8'
		},
    params: parameter,
  })
}
// 删除news
export function newsDelete (parameter) {
  return request({
    url: newsApi.Delete,
    method: 'post',
		headers: {
		  'Content-Type': 'application/json;charset=UTF-8'
		},
    params: parameter,
  })
}

